package org.springboot3.project.demoapi;

import org.apache.dubbo.common.stream.StreamObserver;

public interface StreamDemoService {

    /**
     * 服务端模式调用，客户端发送一次，服务端可以多次返回
     *
     * @param requestId 客户端请求信息，requestId
     * @param response  stream响应流对象传递给客户端
     */
    void serverStream(String requestId, StreamObserver<String> response);

    /**
     * 客户端流式调用,其实也是双向流，
     * dubbo不允许StreamObserver<String> clientStream()之类的定义，必须有response StreamObserver否则启动就会报错
     * 客户端发送n次，服务端也能返回多次
     *
     * @param response
     * @return
     */
    StreamObserver<String> clientStream(StreamObserver<String> response);

    // 双向流式调用
    StreamObserver<String> bidirectionalStream(StreamObserver<String> response);
}
